<template>
  <div class="login-box center">
    <div>login</div>
    <van-button type="danger" size="small" @click="loginReq">登录</van-button>
  </div>
</template>

<script setup lang="ts">
import { LoginData } from '@/api/auth/types';
import { useUserStoreHook } from '@/store/modules/user';
import { Loading } from '@/utils/tools';

const userStore = useUserStoreHook();
const userForm: LoginData = {
  username: '',
  password: '',
};

function loginReq() {
  Loading();
  userStore.login(userForm).then((res) => {
    console.log(res);
    Loading(false);
  });
}
</script>

<style scoped lang="scss">
.login-box {
  height: 400px;
  margin-top: 200px;
  flex-direction: column;
}
</style>
